import { ref, computed } from 'vue'
import i18n from '@/i18n'
export const useRulesEffect = (validatePassword) => {
  const loginRules = ref({
    username: [
      {
        required: true,
        trigger: 'blur',
        message: computed(() => {
          return i18n.global.t('msg.login.usernameRule')
        })
      }
    ],
    password: [
      {
        required: true,
        trigger: 'blur',
        validator: validatePassword()
      }
    ]
  })
  return {
    loginRules
  }
}
